home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / misc~1 / 199 / olddoc < prev    next >
Encoding:
Text File  |  1988-03-14  |  11.6 KB  |  248 lines

  1.      Mark Johnson's C  (pak-870501)
  2.  
  3. This contains a limited shareware C compiler for your use and enjoyment.
  4. You should find a number of file groups in this archive which contain the
  5. following:
  6.  
  7.   bin.arc
  8.     cc.ttp      - translates C code to intermediate code
  9.     as.ttp      - translates intermediate code to machine code
  10.     hd.ttp      - hex dump utility
  11.     cat.ttp     - file concatenation utility
  12.     grep.ttp    - utility to search for a string in a file
  13.     ss.ttp      - simple spreadsheet program
  14.     mkt.bat     - batch to compile "x.c" into "x.ttp"
  15.     mkp.bat     - batch to compile "x.c" into "x.prg"
  16.     obj.bat     - batch to compile "x.c" into "x.s"
  17.     gemdemo.prg - file selector demo
  18.  
  19.   lib.arc
  20.     prg.s       - startup intermediate code for .PRG programs
  21.     ttp.s       - startup intermediate code for .TTP programs
  22.     lib.a       - used to create .TTP programs
  23.     aes.a       - aes calls and .PRG hooks
  24.     vdi.a       - all vdi calls
  25.     lib.c       - source for:lib.a
  26.     aes.c       -          aes.a
  27.     vdi.c       -          vdi.a
  28.     stdio.h     - standard i/o header used only in .TOS or .TTP
  29.     gem.h       - header used only in .PRG
  30.  
  31.   src.arc
  32.     ss.c        - a simple spreadsheet program
  33.     cat.c       - the file concat program
  34.     grep.c      - the string search program
  35.     hd.c        - the hex dump program
  36.     gemdemo.c   - outline of what MJC requires for GEM programs
  37.  
  38. You will also find in the root directory:
  39.  
  40.     command.tos - public domain (PD) command line interpreter
  41.     boot.bat    - copy tools into the ramdisk
  42.     desktop.inf - a custom setup needed by this package
  43.     rmd209.acx  - PD ramdisk for stock 520's
  44.     rmd360k.acx - PD ramdisk for 1040's
  45.     readme      - this file
  46.  
  47.  
  48. SETTING UP --
  49.  
  50. When you de-arc this package, you will find three .ARC files and the six
  51. other files.  First copy "command.tos", "boot.bat", and "desktop.inf" files
  52. to a blank, newly formatted disk.  Then you may select the ramdisk you want
  53. from those provided, or one you may already have, and move it to the disk.
  54. If you use one of these ramdisks, make sure to change the extender to .ACC.
  55.  
  56. Now, create three new folders on your disk.  Name them "BIN", "LIB" and "SRC".
  57. Then de-arc each remaining .ARC into the respective folder.  That is, de-arc
  58. "BIN.ARC" into folder "BIN" and so on.
  59.  
  60. Find a good text on programming in "C" if you are unfamiliar with the language.
  61. I (M_Kg) suggest "C PRIMER PLUS" by Waite, Prata and Martin from Howard W. Sams
  62. & Co., Inc.; 1984.  It is an easy to follow, friendly introduction to C written
  63. with a sense of humor but also serious enough to help those familiar with C.
  64. Also suggested (by M_J) is the C "bible" by Kerrington & Richie (See below).
  65.  
  66. A text editor is also needed to create your C source code.  Any editor which
  67. produces pure ASCII (meaning no control chars in the file except CR/LF and TAB)
  68. may be used. The microEMACS package available in ATARI16 of Compuserve is best.
  69.  
  70.  
  71. MARK JOHNSON'S "C" --
  72.  
  73. The compiler (cc.ttp) is preprocessor, parser, and code generator all rolled
  74. into a single program.  Please refer to the "C Programming Language" by K&R.
  75. The compiler has the following features, limitations, and shortcomings:
  76.  
  77.   features
  78.     - symbol names can be any length
  79.     - built-in "trap" generator "trap(NUM, arg1, arg2, ...)"
  80.  
  81.   limitations
  82.     - Only globals can be (very carefully) initialized.  No type checking
  83.       is done between the initializing value and the type of the global
  84.       being initialized.  This is crude but it works.  Accepted initializer
  85.       values are (long or short) constant expressions, strings, and symbols.
  86.  
  87.   what's missing
  88.     - type specifiers: float double auto static
  89.     - goto and labels
  90.     - preprocessor: #undef and the #if family
  91.     - structure assignments
  92.  
  93. The output of the compiler is ascii text and each line maps into a
  94. single instruction.  This intermediate code is as terse as I can make it (to
  95. save disk space) but is still readable (by me at least).  (I have plans to
  96. improve this to make things easier for an optimizer).  The output of the
  97. compiler is always placed in a file called "yc.out" in the current directory.
  98. Any error messages are displayed on the screen.  Please note that the compiler
  99. output is unique and is not compatible with other assemblers for the ST.
  100.  
  101. The assembler (as.ttp) reads the intermediate code in a single pass and
  102. keeps everything in memory before generating the file "ya.out" in the
  103. current directory.  The size limit of the program to be compiled is basically
  104. the size of the available memory.  The "ya.out" file should be renamed to
  105. one of the standard extensions (.TTP, .PRG, .TOS) before executing it.
  106. The command line of the assembler should always list a startup file
  107. first (see mkp.bat or mkt.bat) then the intermediate files of the program,
  108. then "-L" followed by any libraries.  Any errors encountered by the
  109. assembler terminates assembly.  A "-M" argument to the assembler will
  110. generate an address map of all global symbols in the file "ya.map".
  111.  
  112. A library is simply intermediate code, but is handled differently by the
  113. assembler than regular intermediate code.  Intermediate code (the
  114. files before "-L") are read and processed directly; all symbols and
  115. code are accepted without question.  A library is read without processing
  116. until a symbol is found that is needed but not defined.  From that point
  117. on, the library is read and processed until the next symbol is encountered.
  118. At the next symbol, the "needed but not defined" test is applied again
  119. and processing or scanning continues as necessary.  The "intelligence" of
  120. the assembler insures the resulting programs are as compact as possible.
  121.  
  122. The libraries include TOS, VDI, and AES routines taken from the Abacus books.
  123. I plan to document the library routines later.  I have also included basic
  124. <stdio.h> routines.  I have included the source for lib.a, aes.a, and vdi.a
  125. (see lib.c and aes.c, vdi.c).  A lot of library routines you would expect
  126. to see are missing, and for that I apologize.
  127.  
  128. Creating .TTP programs is straightforward and better tested than .PRG (GEM)
  129. program creation.  In a .TTP process, the main function is called with
  130. the standard arguments:
  131.  
  132.         main(argc, argv) int argc; char *argv[];
  133.  
  134. Redirection of input and output using >outfile, >>appendfile, or <infile
  135. on the command line is handled by a startup routine linked into the
  136. compiled program.  Reads and writes to the screen are built to map '\n'
  137. to/from "\n\r".
  138.  
  139. GEM programs are called by:
  140.  
  141.         main()
  142.  
  143. The argc and argv are not allowed at this time.  Also, all input/output must
  144. be handled by GEMDOS, BIOS or XBIOS calls and not through "stdio.h" routines.
  145. Exiting through the "appl_exit" call is handled and should not be included
  146. in your program (see gemdemo.c).
  147.  
  148.  
  149. OTHER NOTES --
  150.  
  151. Support for GEM programs (.PRG) is not completely debugged.  I have included
  152. the libraries but must honestly admit they are not yet ready.  All of the
  153. routines found in the Abacus books are present in the library.  The VDI
  154. routines are working.  The window routines, form_alert, and evnt_multi
  155. of AES are working.  My stumbling block right now is adequate documentation
  156. that would enable me to build a (working) Resource Construction Set.
  157. I'm working on it...
  158.  
  159.  
  160. RUNNING IT --
  161.  
  162. *From a Floppy Drive:
  163. Boot with the disk you created earlier.  Then click on "BOOT.BAT" which will
  164. move all the needed files to the ramdisk. (You are using a ramdisk aren't you?)
  165. Now run "COMMAND.TOS".  A .TTP window will open.  Type either "mkp" for GEM
  166. programs or "mkt" for other programs (without the quotes) followed by the path
  167. and name of your C source code created earlier using your text editor.  Be sure
  168. not to include the ".c" extender. Press return.  Wait.  If you made no mistakes
  169. (of course there are no mistakes) the result will be a runnable program! If you
  170. don't cold start to run this program, simply run "COMMAND.TOS" and then enter
  171. "boot" at the {A} prompt and continue from "mkp".
  172.  
  173. *From a Hard Drive:
  174. Just change the BOOT.BAT file so it looks for the files on the correct drive
  175. and continue as above.  For example:
  176.         copy e:\lang\mjc\lib\*.a d:
  177. will move all the library precompiled files to the ramdisk when this package
  178. is stored in logical drive "E" in the "lang" folder as a "mjc" folder.
  179.  
  180. Let me give you an example of how I use these tools.  I normally place
  181. everything I need in the ramdisk before I start by using boot.bat.
  182. I then start command.tos, use "path d:",  and insert a new working disk.
  183. I use microEMACS (available elsewhere) to create or edit C programs.  If I have
  184. a program contained in a single file, I use either mkt.bat or mkp.bat to
  185. compile and link a .TTP or .PRG program, respectively.  For example,
  186.  
  187.         mkt grep
  188.  
  189. will compile the program grep.c and create an executable called grep.ttp.
  190. If the C program is contained in a number of files, I use obj.bat to create
  191. intermediate files having the same names as the C programs except for
  192. an .s extension.  I then link them combining all the intermediate files
  193. together along with the necessary libraries.  For example:
  194.  
  195.         as d:\ttp.s main.s io.s calc.s display.s -L d:\lib.a
  196.         ren ya.out  ss.ttp
  197.  
  198. would serve as the command lines for a (mythical) spreadsheet program.
  199.  
  200.  
  201. -----
  202.  
  203. I bought my 520ST in April 1986.  Almost all the software I have is either
  204. public domain or shareware.  I have supported the shareware idea in the past,
  205. but I'd like to see it happen for myself.  If you like what you find here,
  206. please send a donation along with your name and address.  I'd like to run a
  207. newsletter to discuss bugs, enhancements, and hints.  There is a lot
  208. I would like to do with this in the future.  Many of the limitations are
  209. easy to fix, and I really do need a Resource Construction Set (if I can
  210. only figure out how to make object trees that work!).  I hope you enjoy
  211. this software.  It is not for sale by anyone, and I reserve all rights
  212. to its ownership.  Feel free to pass it on to other ST owners, but please
  213. pass on the whole disk, including this "readme" file.  I welcome any comments
  214. you may have; send mail to:
  215.  
  216.         Mark A. Johnson
  217.         85 Coleman Ave
  218.         Red Bank, NJ 07701
  219.  
  220. -----
  221.  
  222. Hi, I have declared myself [un]official product rep for Mark Johnson's C
  223. here on CompuServe.  This means I will post updates as they come out and
  224. hope to find a GEMDOS library to post here.  If you have _minor_ problems,
  225. I might be able to help.  However, I cannot help if you have _major_ problems.
  226. (Like form_alert accepting only constant strings)  Please direct those types
  227. of bugs to Mark Johnson.  As I become more familiar with this package, this
  228. may change, and of course, I am always happy to find out about anything you may
  229. discover (good or bad) about Mark Johnson's C.
  230.  
  231. If you find this package helpful, useful, entertaining, or even completely
  232. useless, please consider a donation along with your comments and critical
  233. remarks.  But do not send money to me, Mark Johnson is the one who deserves
  234. all the credit and reward for this product.
  235.  
  236. I got my 1040ST in May 1986 and have been using it almost nonstop ever since,
  237. mostly to interface with the VAXnet at U of Houston and with CompuServe.  The
  238. majority of my software, unlike Mark J's, is commercial.  However, I feel just
  239. as strongly about the shareware concept.  Having seen the work that went into
  240. this product, I am willing to support Mark J in his attempt to bring great
  241. software to ST users at a next-to-nothing price and I hope you will too.
  242.  
  243.         Mark Kelling [71550,1151]
  244.  
  245. { Archive Updated 01 May 1987 with the newly revised GEM routines
  246. { Text of this file updated 03 May 1987.
  247.  
  248.